import React from "react";
import { Table } from "antd";
import { useTranslation } from "react-i18next";

export default function ProjectBindPoint(props) {
  const { tableList, tableHeight } = props;
  const { t } = useTranslation();

  const columns = [
    {
      dataIndex: "idx",
      align: "center",
      width: 40,
      render: (_, record, index) => <>{index + 1}</>,
    },
    {
      title: t("market.point"),
      dataIndex: "point",
      align: "center",
    },
    {
      title: t("common.status"),
      align: "center",
      width: 100,
      render: (_, record) => (
        <>
          {record.status === "0" ? (
            <span>{t("common.enable")}</span>
          ) : (
            <span style={{ color: "red" }}>{t("common.disable")}</span>
          )}
        </>
      ),
    },
    {
      title: t("market.operator"),
      dataIndex: "username",
      align: "center",
    },
    {
      title: t("market.operation_time"),
      dataIndex: "u_time",
      align: "center",
    },
  ];
  return (
    <>
      <Table
        dataSource={tableList}
        size="small"
        bordered
        columns={columns}
        rowKey="point_id"
        virtual
        scroll={{
          y: tableHeight,
        }}
        pagination={false}
      />
    </>
  );
}
